﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using InnvoiceActual.Ws.Facturas;
using InnvoiceActual.Logica.GestorObject.Factura;

namespace InnvoiceActual.Ws.Facturas
{
    /// <summary>
    /// Lógica de interacción para ListadoFacturas.xaml
    /// </summary>
    public partial class ListadoFacturas : Window
    {
        public ListadoFacturas()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

        }

        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key.ToString().ToUpper())
            {
                case "F2":
                   
                    break;
                case "F3":

                    break;
                case "F5":
                    ventana_factura();
                    break;
                case "ESCAPE":
                    this.Close();
                    break;
                default:
                    return;
            }
        }

        private void btnNuevsFactura_Click(object sender, RoutedEventArgs e)
        {
            ventana_factura();
        }

        private void AplicarEfecto(Window win)
        {
            var objBlur = new System.Windows.Media.Effects.BlurEffect();
            objBlur.Radius = 5;
            win.Effect = objBlur;
        }

        private void QuitarEfecto(Window win)
        {
            win.Effect = null;
        }


        private void ventana_factura()
        {
            GenerarFactura miVentanaFactura = new GenerarFactura(new Facturero());
            miVentanaFactura.ShowInTaskbar = false;
            miVentanaFactura.Owner = this; AplicarEfecto(this);
            miVentanaFactura.ShowDialog();
            bool?
            resultado = miVentanaFactura.DialogResult;
            if (resultado != null)
            {
                if (resultado == false)
                {
                    QuitarEfecto(this);
                }
            }
        }


    }
}
